<template>
	<div class="elementb_page">
		<h4>我是组件B</h4>
		<mt-field label="组件B" placeholder="请输入" v-model="elementbVlaue"></mt-field>
		<mt-button type="danger" size="large" @click="getValueFromElea">把值传给A</mt-button>
	</div>


</template>

<script>
	import {Field} from 'mint-ui';
	import Bus from './../bus/bus.js';
	export default {
		components:{
			Field
		},
		data(){
			return{
				elementbVlaue:'',
			}
		},
		methods:{
			getValueFromElea(){
				Bus.$emit('val',this.elementbVlaue);
			}
		},
		mounted(){
			const that = this;
			Bus.$on('val',(data)=>{
				that.elementbVlaue = data;
			})
		}
	}

</script>

<style>
	

</style>